# 练习3：输入三条边长，如果能构成三角形就计算周长和面积。
import math

def input_line(n):
    input_data = input(f'input line {n}\n')
    try:
        line = float(input_data)
        return line
    except:
        return None

def is_triangle(line_nums):
    if len(line_nums) == 3:
        if line_nums[0] + line_nums[1] > line_nums[2] \
            and line_nums[0] + line_nums[2] > line_nums[1] \
                and line_nums[1] + line_nums[2] > line_nums[0]:
                return True
        else:
            return False
    else:
        return False 

if __name__ == '__main__':
    while True:
        line_nums = []
        for i in range(0, 3):
            line = input_line(i+1)
            if line:
                line_nums.append(line)
                continue
            else:
                print('input error')
                break
        if is_triangle(line_nums):
            d = line_nums[0] + line_nums[1] + line_nums[2]
            print('d = {}'.format(d))
            p = d / 2
            s = math.sqrt((p * (p - line_nums[0]) * (p - line_nums[1])\
                 * (p - line_nums[2])))
            print('s = {}'.format(s))
        else:
            print('not a triangle')
            break    